package in.sv.yaazhi.bs.intf;

import in.sv.yaazhi.bs.action.intf.ReplicateRagaActions;
import in.sv.yaazhi.dao.RagaVO;
import in.sv.yaazhi.entity.Raga;

public abstract class ReplicateBS {
	
	private ReplicateRagaActions replicateRagaActions = null;

	public void replicateRaga(RagaVO ragaVO) {

		Raga raga = null;

		// Orchestration flow
		raga = getReplicateRagaActions().getRaga(ragaVO);

		int isRagaExisting = getReplicateRagaActions()
				.checkIsRagaExisting(raga);

		if (isRagaExisting == ReplicateRagaActions.RAGA_NEW) {
			raga = getReplicateRagaActions().createRaga(ragaVO);
		} else if (isRagaExisting == ReplicateRagaActions.RAGA_UPDATE) {
			raga = getReplicateRagaActions().updateRaga(raga, ragaVO);
		}

	}

	private ReplicateRagaActions getReplicateRagaActions() {

		return replicateRagaActions;
	}

}
